import 'animate.css';
import Antd from 'ant-design-vue';

import { MotionPlugin } from '@vueuse/motion';
import { createPinia } from 'pinia';
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate';
import { createApp } from 'vue';
import App from './App.vue';
import './style/index.scss';
import './style/tailwind.scss';
import router from './router';
import './api/config/interceptor';
import { getUserRouters } from './api/modules/user/utils';
import { initI18n, i18n } from './i18n';
import directive from './directive';
const app = createApp(App);

const bootstrap = async () => {
  await getUserRouters();
  await initI18n();
  app.use(MotionPlugin);
  app.use(router);
  app.use(directive);
  /* @ts-ignore */
  app.use(i18n);
  app.mount('#app');
  app.use(Antd);
  const pinia = createPinia();
  pinia.use(piniaPluginPersistedstate);
  app.use(pinia);
  app.config.globalProperties.$t = i18n.global.t;
};

bootstrap();
